package com.git.hui.yinshua.api.model;

/**
 * @author YiHui
 * @date 2024/6/7
 */
public class ExceptionUtil {


    public static BizException newBizException(int code, String msg) {
        return new BizException(code, msg);
    }

    public static BizException newBizException(String msg) {
        return newBizException(500, msg);
    }

    public static BizException of(Status.StatusEnum status, Object... args) {
        if (args.length > 0) {
            return newBizException(status.getCode(), String.format(status.getMsg(), args));
        } else {
            return newBizException(status.getCode(), status.getMsg());
        }
    }
}
